<template>
  <div v-if="item">
    <el-sub-menu v-if="item.children && item.children.length" :index="item.id">
      <template #title>
        <span>{{ item.name }}</span>
      </template>
      <goods-type-children v-for="(child, index) in item.children" :key="child.id + index" :item="child"></goods-type-children>
    </el-sub-menu>
    <el-menu-item v-else :index="item.id">
      <span>{{ item.name }}</span>
    </el-menu-item>
  </div>
</template>

<script setup name="goodsTypeChildren">
const props = defineProps({
  // route object
  item: {
    type: Object,
    required: true
  },
  basePath: {
    type: String,
    default: ''
  }
})
</script>

<style lang="scss" scoped></style>